<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require("db_conn.php");//包含连接文件
$sql="SELECT * FROM service_b";   //写查询语句
$typer=$db->query($sql); //执行语句  $rs是一个结果集
$tyerows=$typer->fetch_all(MYSQLI_BOTH); 

$typeid=isset($_GET['id'])?$_GET['id']:-1;
    if ($typeid==-1)
       $sql="select a.*,b.typename from service a,service_b b  where a.typeid=b.id ";   //写新闻查询语句  
    else
       $sql="select a.*,b.typename from service a,service_b b  where a.typeid=b.id and a.typeid=$typeid";
   $ser=$db->query($sql); //执行语句  $rs是一个结果集
$serrows=$ser->fetch_all(MYSQLI_BOTH);  
require 'service_html.php';
//释放结果集
//$result->free();
//关闭数据库
$db->close();
